#include <iostream>
#include <cstdio>
#include "UdpServer.hpp"

#include <memory> //智能指针
#include "MessageRoute.hpp"

int main(int argc, char *argv[])
{
   
    if (argc != 2)
    {
        std::cout << "Usage:\n\t" << "local_port\n"
                  << std::endl;
    }

    uint16_t port = std::stoi(argv[1]);

    MessageRoute chat;
    
    std::unique_ptr<UdpServer> user = std::make_unique<UdpServer>(port,\
    std::bind(&MessageRoute::Route, &chat, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));

    user->InitServer();
    
    user->Start();
    
    return 0;
}